<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <link rel="stylesheet" href="__PUBLIC__/Css/public.css"/>
    <link rel="stylesheet" href="__PUBLIC__/Css/Node.css"/>
    <script type="application/javascript" src="__PUBLIC__/Js/jquery-1.7.2.min.js"></script>
    <script type="application/javascript">
        $(function(){
            $('input[level=1]').click(function () {
            var inputs=$(this).parents('.app').find('input');
            $(this).attr('checked')?inputs.attr('checked','checked'):inputs.removeAttr('checked');

        });
            $('input[level=2]').click(function () {
            var inputs=$(this).parents('dl').find('input');
            $(this).attr('checked')?inputs.attr('checked','checked'):inputs.removeAttr('checked');

        })

        })
    </script>
    <title>Title</title>
</head>
<body>
<table>
    <form action="{:U('admin/rbac/access_post')}">
    <div id="wrap">
        <foreach name="node" item="app">
            <div class="app">
                <p>
                    <label style="">
                     <strong>
                         {$app.name}
                     </strong>
                        <input type="checkbox" name="access[]"
                               value="{$app.id}_1" level="1" {$app['access']?'checked=':''} >

                    </label>

                </p>
                <foreach name="app.child" item="controll">
                    <dl>
                        <dt>
                           <strong>{$controll.name}</strong>
                            <input type="checkbox" name="access[]" value="{$controll.id}_2" level="2" {$controll['access']?'checked=':''}
                            >
                        </dt>
                        <foreach name="controll.child" item="action">
                            <dd>
                              <span>{$action.name}</span>
                                <input type="checkbox" name="access[]" value="{$action.id}_3" level="3" {$action['access']?'checked=':''}
                                >
                            </dd>
                        </foreach>
                    </dl>
                </foreach>
            </div>
        </foreach>
        <input type="text" name="role_id" value="{$rid}" hidden="hidden">
    </div>
        <input type="submit" style="margin: 20px" value="提交">
    </form>
</table>
</body>
</html>